﻿Public Class frmRelatorioPedido

    Dim objPedido As New CLSPedidos
    Dim objbanco As New CLSBanco



    Dim sql As String

    Public Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        If DataGridViewped.Rows.Count > 0 Then
            Dim relatorio As New CrystalReport1
            relatorio.SummaryInfo.ReportTitle = "Rel.Pedidos "
            relatorio.SummaryInfo.ReportComments = "Ref. Clientes."
            frmImp.Show()
            'com esssa linha imprime o relatorio da grade
            relatorio.SetDataSource(DataGridViewped.DataSource)
            'com essa imprime tudo

            frmImp.crpImpressao.ReportSource = relatorio
        End If

    End Sub
    'DataGridViewped.DataSource = objPedido.mostrarPedido(txtCodigoped.Text)


    Private Sub txtCodigoped_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCodigoped.TextChanged
        DataGridViewped.DataSource = objPedido.mostrarPedido(txtCodigoped.Text)
        LbnRegistro.Text = DataGridViewped.Rows.Count - 1 & " registros"
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        DataGridViewped.DataSource = objPedido.LocalizarPordata(cboSitPed.Text)
        If DataGridViewped.Rows.Count > 0 Then
            Dim relatorio As New crpSitped
            relatorio.SummaryInfo.ReportTitle = "Rel.Pedidos "
            relatorio.SummaryInfo.ReportComments = "Ref. Clientes."
            frmImp.Show()
            'com esssa linha imprime o relatorio da grade
            relatorio.SetDataSource(DataGridViewped.DataSource)
            'com essa imprime tudo

            frmImp.crpImpressao.ReportSource = relatorio
        End If
    End Sub

End Class